<template>
  <div>
    <div class="top">
      <div class="top-title">
        <i class="el-icon-arrow-left" @click="$router.back()"></i>
        考核人员
      </div>
      <!-- <div>
        <div v-for="(item, index) in jibies" :key="index" class="top-jibie shou" :class="index_jibie === index?'top-select':''" @click="index_jibie=index">{{item.name}}</div>
      </div>-->
    </div>
    <el-tabs v-model="typeId" @tab-click="getData" style="
  padding: 0px 24px 20px 24px;">
      <el-tab-pane label="情景题" name="1">
        <div class="body">
          <div class="body-top">
            <div style="margin-left:30px">筛选：</div>
            <div
              class="shou"
              style="margin-right:22px"
              :style="status===''?'color:#1E90FB':'color:#666666'"
              @click="status=''"
            >全部</div>
            <div
              class="shou"
              style="margin-right:22px"
              :style="status===true?'color:#1E90FB':'color:#666666'"
              @click="status=true;"
            >已批</div>
            <div
              class="shou"
              style="margin-right:22px"
              :style="status===false?'color:#1E90FB':'color:#666666'"
              @click="status=false;"
            >未批</div>
          </div>
          <div
            class="card shou"
            v-for="(item, index) in table"
            :key="index"
            v-show="status===''||(status===true&&(item.status==1||item.status==4))||(status===false&&(item.status==0||item.status==2))"
            @click="toTestPaper(item)"
          >
            <div :class="item.status==0||item.status==2?'icon1':'icon2'">{{item.status==0||item.status==2?'未批':'已批'}}</div>
            <el-tooltip class="item" effect="dark" :content="item.examineeVo.name" placement="top">
              <div class="card-title shenglue">{{item.examineeVo.name}}</div>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              :content="item.examineeVo.professionName"
              placement="top"
            >
              <div class="card-text">专业：{{item.examineeVo.professionName}}</div>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              :content="item.examineeVo.idcard"
              placement="top"
            >
              <div class="card-text">身份证号：{{item.examineeVo.idcard}}</div>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              :content="item.paperTotalScore+'分'"
              placement="top"
            >
              <div class="card-text">总分：{{item.paperTotalScore}}分</div>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" :content="getScore(item.practiceScore)+'分'" placement="top">
              <div class="card-text1 fl">
                得分：
                <span v-if="true" style="color:#1E90FB">{{getScore(item.practiceScore)}}</span>
                <span v-if="true">分</span>
                <span v-if="false">-</span>
              </div>
            </el-tooltip>
            <div
              v-if="item.status==1||item.status==4"
              class="card-text1 fr shou"
              style="color:#F70D0D;border-bottom: 1px solid #F70D0D"
            >重新打分</div>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane label="案例题" name="2">
        <div class="body">
          <div class="body-top">
            <div style="margin-left:30px">筛选：</div>
            <div
              class="shou"
              style="margin-right:22px"
              :style="status===''?'color:#1E90FB':'color:#666666'"
              @click="status=''"
            >全部</div>
            <div
              class="shou"
              style="margin-right:22px"
              :style="status===true?'color:#1E90FB':'color:#666666'"
              @click="status=true;"
            >已批</div>
            <div
              class="shou"
              style="margin-right:22px"
              :style="status===false?'color:#1E90FB':'color:#666666'"
              @click="status=false;"
            >未批</div>
          </div>
          <div
            class="card shou"
            v-for="(item, index) in table"
            :key="index"
            v-show="status===''||(status===true&&(item.status==2||item.status==4))||(status===false&&(item.status==0||item.status==1))"
            @click="toTestPaper(item)"
          >
            <div :class="item.status==0||item.status==1?'icon1':'icon2'">{{item.status==0||item.status==1?'未批':'已批'}}</div>
            <el-tooltip class="item" effect="dark" content="匿名" placement="top">
              <div class="card-title shenglue">匿名</div>
            </el-tooltip>
            <!-- <el-tooltip class="item" effect="dark" :content="item.examineeVo.name" placement="top">
              <div class="card-title shenglue">{{item.examineeVo.name}}</div>
            </el-tooltip> -->
            <!-- <el-tooltip
              class="item"
              effect="dark"
              :content="item.examineeVo.professionName"
              placement="top"
            >
              <div class="card-text">专业：{{item.examineeVo.professionName}}</div>
            </el-tooltip> -->
            <!-- <el-tooltip
              class="item"
              effect="dark"
              :content="item.examineeVo.idcard"
              placement="top"
            >
              <div class="card-text">身份证号：{{item.examineeVo.idcard}}</div>
            </el-tooltip> -->
            <el-tooltip
              class="item"
              effect="dark"
              :content="item.paperTotalScore+'分'"
              placement="top"
            >
              <div class="card-text">总分：{{item.paperTotalScore}}分</div>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" :content="getScore(item.caseScore)" placement="top">
              <div class="card-text1 fl">
                得分：
                <span v-if="true" style="color:#1E90FB">{{getScore(item.caseScore)}}</span>
                <span v-if="true">分</span>
                <span v-if="false">-</span>
              </div>
            </el-tooltip>
            <div
              v-if="item.status==2||item.status==4"
              class="card-text1 fr shou"
              style="color:#F70D0D;border-bottom: 1px solid #F70D0D"
            >重新打分</div>
          </div>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import $httpJSON from "@/utils/request";

export default {
  name: "Dashboard",
  computed: {
    ...mapGetters(["name"])
  },
  data() {
    return {
      typeId: '1',
      status: "",
      span1: 3,
      span2: 9,
      dialogAdd: false,
      index_jibie: 0,
      value: "",
      values: [],
      table: [],
      type: 0,
      jibies: [
        {
          name: "级别一",
          value: 1
        },
        {
          name: "级别二",
          value: 2
        }
      ],
      zhuanyes: [
        {
          panduan: false
        },
        {
          panduan: false
        }
      ],
      form: {
        id: ""
      }
    };
  },
  mounted() {
    this.typeId = localStorage.getItem('typeId')||'1'
    this.form = JSON.parse(localStorage.getItem("info"));
    this.getData();
  },
  methods: {
    getScore(val) {
      if(val+''==='0') {
        return 0
      }
      return val?val:'-'
    },
    getData() {
      this.table = []
      this.$httpJSON
        .get("/examiner/query/examineelist/" + this.$route.query.id, {
          params: {
            status: '',
            typeId: this.typeId,
          }
        })
        .then(response => {
          if (response.success) {
            let table = new Array(response.data.length)
            if (this.typeId == 1) {
              table = response.data
            } else {
              let k = 3
              for (let i = 0; i < response.data.length; i++) {
                if (i + k < response.data.length) {
                  table[i+k] = response.data[i]
                } else {
                  table[i+k-response.data.length] = response.data[i]
                }
              }
            }
            this.table = table;
          } else {
            this.table = [];
            // this.$message({
            //   message: response.msg,
            //   type: "error",
            //   duration: 2000
            // });
          }
        })
        .catch(error => {
          console.log(error);
        });
    },
    toTestPaper(item) {
      this.$router.push({
        path: "/testPaper", //目标路径
        query: {
          examId: item.examId, //要传的值
          paperId: item.paperId, //要传的值
          id: item.examineeVo.id, //要传的值
          typeId: this.typeId //要传的值
        }
      });
    },
    select(val) {
      this.type = val;
    }
  }
};
</script>

<style lang="scss" scoped>
.top-jibie {
  float: left;
  width: 60px;
  height: 46px;
  margin-right: 30px;
  color: rgba(153, 153, 153, 100);
  font-size: 14px;
  text-align: center;
  font-family: PingFangSC-Regular;
  display: flex;
  justify-content: center;
  align-items: center;
}
.top-select {
  color: #1890ff;
  border-bottom: 2px solid #1890ff;
}
.top-title {
  // margin-top: -20px;
  float: left;
  width: 100px;
  height: 40px;
  font-size: 16px;
  color: rgba(51, 51, 51, 100);
  font-size: 20px;
  display: flex;
  // justify-content: center;
  // align-items: center;
}
.body {
  display: flex;
  justify-content: space-around;
  // align-items: center;
  flex-wrap: wrap;

  width: 100%;
}
.body-top {
  width: 100%;
  height: 45px;
  margin-bottom: 20px;
  display: flex;
  // justify-content: center;
  align-items: center;
  color: rgba(102, 102, 102, 100);
  font-size: 14px;
  background-color: white;
}
.card {
  width: 277px;
  height: 174px;
  // height: 144px;
  margin-bottom: 24px;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.09);
  padding: 18px 20px 18px 20px;
}
.card-title {
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: bold;
  color: rgba(51, 51, 51, 100);
}
.card-text {
  width: 100%;
  height: 25px;
  line-height: 25px;
  // margin-top: 5px;
  font-size: 14px;
  color: rgba(102, 102, 102, 100);
}

.card-text1 {
  // width: 50%;
  height: 25px;
  line-height: 25px;
  // margin-top: 5px;
  font-size: 14px;
  color: rgba(102, 102, 102, 100);
}
.icon1 {
  width: 52px;
  height: 29px;
  margin-top: -18px;
  margin-right: -20px;
  font-size: 14px;
  float: right;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 2px;
  background-color: rgba(30, 144, 251, 1);
  color: white;
}
.icon2 {
  width: 52px;
  height: 29px;
  margin-top: -18px;
  margin-right: -20px;
  font-size: 14px;
  float: right;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 2px;
  background-color: rgba(229, 229, 229, 1);
  color: #999999;
}
</style>
